<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改奖品')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-prize-edit" th:object="${prize}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label">奖品名称：</label>
                <div class="col-sm-8">
                    <input th:field="*{name}" class="form-control" type="text" readonly>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">奖品总数：</label>
                <div class="col-sm-8">
                    <input th:field="*{sumNum}" class="form-control" type="text" readonly>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">剩余数量：</label>
                <div class="col-sm-8">
                    <input th:field="*{num}" class="form-control" type="text" readonly>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">状态：</label>
                <div class="col-sm-8">
                    <div class="radio-box" th:each="dict : ${@dict.getType('prize_status')}">
                        <input type="radio" th:id="${'status_' + dict.dictCode}"
                               th:value="${dict.dictValue}" th:checked="${dict.default}"
                               th:field="*{status}" readonly>
                        <label th:for="${'status_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">概率：</label>
                <div class="col-sm-8">
                    <input th:field="*{probability}" class="form-control" type="text" readonly>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">奖品图标：</label>
                <div class="col-sm-8">
                    <p id="show_main">
                        <img th:src="*{icon}" style="width:80px;height:80px;">
                    </p>
                </div>
            </div>
            <div class="form-group" th:style="'display:'+ @{(*{type}==0? 'block':'none')}">
                <label class="col-sm-3 control-label">优惠券：</label>
                <div class="col-sm-8">
                    <select  class="form-control m-b" readonly>
                        <option value="">请选择优惠券</option>
                        <option th:each="dict : ${yhList}" th:text="${dict.name}"
                                th:value="${dict.id}"  th:field="*{resId}" required></option>
                    </select>
                </div>
            </div>
            <div class="form-group" th:style="'display:'+ @{(*{type}==2? 'block':'none')}">
                <label class="col-sm-3 control-label">智通币数量：</label>
                <div class="col-sm-8">
                    <input th:field="*{coinNum}" class="form-control" type="text" readonly>
                </div>
            </div>
            <div class="form-group" th:style="'display:'+ @{(*{type}==1? 'block':'none')}">
                <label class="col-sm-3 control-label">抵扣券：</label>
                <div class="col-sm-8">
                    <select class="form-control m-b" readonly>
                        <option value="">请选择抵扣券</option>
                        <option th:each="dict : ${dkList}" th:text="${dict.name}"
                                th:value="${dict.id}"  th:field="*{resId}" required></option>
                    </select>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script type="text/javascript">
        var prefix = ctx + "system/prize";
        $("#form-prize-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-prize-edit').serialize());
            }
        }

        $("input[name='created']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
    </script>
</body>
</html>